HAL DTS types migration

This section provides information about the HAL DTS types migration.

HAL DTS enumeration migration

HAL DTS state type definition

In HAL2, the state machine of the DTS is split into two separate state machines: hal_dts_state_t and hal_dts_sensor_state_t.

HAL1

HAL2

typedef enum
{
  HAL_DTS_STATE_RESET,
  HAL_DTS_STATE_READY,
  HAL_DTS_STATE_BUSY,
  HAL_DTS_STATE_ERROR,
  HAL_DTS_STATE_TIMEOUT
} HAL_DTS_StateTypeDef;
typedef enum
{
  HAL_DTS_STATE_RESET,
  HAL_DTS_STATE_CONFIGURED
} hal_dts_state_t;

typedef enum
{
  HAL_DTS_SENSOR_STATE_RESET,
  HAL_DTS_SENSOR_STATE_IDLE,
  HAL_DTS_SENSOR_STATE_ACTIVE
} hal_dts_sensor_state_t;

Related concept: Replaced TypeDef suffix with _t in type names


HAL DTS callback ID type definition

HAL1

HAL2

typedef enum
{
  HAL_DTS_MEAS_COMPLETE_CB_ID,
  HAL_DTS_HIGH_THRESHOLD_CB_ID,
  HAL_DTS_LOW_THRESHOLD_CB_ID,
  HAL_DTS_ASYNC_MEAS_COMPLETE_CB_ID,
  HAL_DTS_ASYNC_HIGH_THRESHOLD_CB_ID,
  HAL_DTS_ASYNC_LOW_THRESHOLD_CB_ID,
  HAL_DTS_MSPINIT_CB_ID,
  HAL_DTS_MSPDEINIT_CB_ID
} HAL_DTS_CallbackIDTypeDef;

Removed in HAL2:

  • Enumeration replaced by dedicated registration APIs: HAL_DTS_RegisterCpltCallback(), HAL_DTS_RegisterLowThresholdCallback(), HAL_DTS_RegisterHighThresholdCallback().

  • MSP callback IDs (HAL_DTS_MSPINIT_CB_ID, HAL_DTS_MSPDEINIT_CB_ID) removed (MSP init/deinit internalized).

  • Async-specific IDs merged; optional async interrupts selected via HAL_DTS_StartSensor_IT_Opt() instead of separate callback IDs.

Related concepts :


HAL DTS structure migration

HAL DTS configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t QuickMeasure;
  uint32_t RefClock;
  uint32_t TriggerInput;
  uint32_t SamplingTime;
  uint32_t Divider;
  uint32_t HighThreshold;
  uint32_t LowThreshold;
} DTS_InitTypeDef;
typedef struct
{
  hal_dts_reference_clock_t   reference_clock;
  hal_dts_quick_measurement_t quick_measurement;
  uint8_t                     high_speed_clock_division;
} hal_dts_config_t;

typedef struct
{
  hal_dts_trigger_t       trigger;
  hal_dts_sampling_time_t sampling_time;
} hal_dts_sensor_config_t;
 /* HighThreshold/LowThreshold moved to HAL_DTS_SetSensorThresholds() runtime API */

Related concept: Replaced TypeDef suffix with _t in type names


HAL DTS handle type definition

HAL1

HAL2

DTS_HandleTypeDef;

hal_dts_handle_t;

Related concept: Replaced TypeDef suffix with _t in type names


HAL DTS callback type definition

HAL1

HAL2

pDTS_CallbackTypeDef

hal_dts_cb_t

Related concept: Replaced TypeDef suffix with _t in type names